package com.uwo.commons.samples.service.impl;

import com.uwo.commons.configuration.aop.validate.annotation.NotNull;
import com.uwo.commons.configuration.aop.validate.annotation.ValidateMethod;
import com.uwo.commons.configuration.aop.validate.excepteion.ApiValidateExceptrion;
import com.uwo.commons.samples.beans.User;
import com.uwo.commons.samples.service.IndexService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by yanhao on 2018/1/28.
 */
@Service
public class IndexServiceImpl implements IndexService{

    @ValidateMethod
    public Object test(User user, @NotNull String content) throws ApiValidateExceptrion {
        Map<String, String> maps = new HashMap<String, String>();
        maps.put("key", user.getName() + " - " + user.getPassword());
        maps.put("content", content);
        return maps;
    }

    @ValidateMethod
    public void test1(User user, String content) {
        Map<String, String> maps = new HashMap<String, String>();
        maps.put("key1", user.getName() + " - " + user.getPassword());
        maps.put("content1", content);
    }
}
